package com.ruoyi.official.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.official.mapper.OfficialDeviceMapper;
import com.ruoyi.official.domain.OfficialDevice;
import com.ruoyi.official.service.IOfficialDeviceService;

/**
 * 设备Service业务层处理
 * 
 * @author yuanqiji
 * @date 2025-03-21
 */
@Service
public class OfficialDeviceServiceImpl implements IOfficialDeviceService 
{
    @Autowired
    private OfficialDeviceMapper officialDeviceMapper;

    /**
     * 查询设备
     * 
     * @param id 设备主键
     * @return 设备
     */
    @Override
    public OfficialDevice selectOfficialDeviceById(Long id)
    {
        return officialDeviceMapper.selectOfficialDeviceById(id);
    }

    /**
     * 查询设备列表
     * 
     * @param officialDevice 设备
     * @return 设备
     */
    @Override
    public List<OfficialDevice> selectOfficialDeviceList(OfficialDevice officialDevice)
    {
        return officialDeviceMapper.selectOfficialDeviceList(officialDevice);
    }

    /**
     * 新增设备
     * 
     * @param officialDevice 设备
     * @return 结果
     */
    @Override
    public int insertOfficialDevice(OfficialDevice officialDevice)
    {
        officialDevice.setCreateTime(DateUtils.getNowDate());
        return officialDeviceMapper.insertOfficialDevice(officialDevice);
    }

    /**
     * 修改设备
     * 
     * @param officialDevice 设备
     * @return 结果
     */
    @Override
    public int updateOfficialDevice(OfficialDevice officialDevice)
    {
        officialDevice.setUpdateTime(DateUtils.getNowDate());
        return officialDeviceMapper.updateOfficialDevice(officialDevice);
    }

    /**
     * 批量删除设备
     * 
     * @param ids 需要删除的设备主键
     * @return 结果
     */
    @Override
    public int deleteOfficialDeviceByIds(Long[] ids)
    {
        return officialDeviceMapper.deleteOfficialDeviceByIds(ids);
    }

    /**
     * 删除设备信息
     * 
     * @param id 设备主键
     * @return 结果
     */
    @Override
    public int deleteOfficialDeviceById(Long id)
    {
        return officialDeviceMapper.deleteOfficialDeviceById(id);
    }
}
